<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>8 模板语法-指令</title>
    <script src="js/vue.global.js"></script>
</head>
<body>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Vue 测试实例 - 菜鸟教程(runoob.com)</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>
<body>
<div id="app">
    <div v-runoob="{ name: '菜鸟教程', url: 'www.runoob.com' }"></div>
</div>

<script>
    const app = Vue.createApp({})
    app.directive('runoob', (el, binding, vnode) => {
        console.log(binding.value.name) // => "菜鸟教程"
        console.log(binding.value.url) // => "www.runoob.com"
        var s = JSON.stringify
        el.innerHTML = s(binding.value)
    })
    app.mount('#app')
</script>
</body>
</html>